package cn.itcast.order;


import cn.itcast.feign.clients.UserClient;
import cn.itcast.feign.config.DefaultFeignConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


@EnableFeignClients(clients = {UserClient.class},defaultConfiguration = DefaultFeignConfiguration.class)
@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    /** @Title
    * 功能描述：
    * 创建restTemplate
    * @Param []
    * @return org.springframework.web.client.RestTemplate
    * @Author 源源源丶🐖源~
    * @Date 2023/6/3 8:35
    */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }



    /** @Title
    * 功能描述：
    * 自定义负载均衡策略
    * @Param []
    * @return com.netflix.loadbalancer.IRule
    * @Author 源源源丶🐖源~
    * @Date 2023/6/3 11:57
    */
//    @Bean
//    public IRule randomRule(){
//        return new RandomRule();
//    }

}